<app-delete-alert [(opened)]="deleteOpened" resourceTypeName="脚本" [items]="selected"
                  (confirm)="delete()"></app-delete-alert>
<clr-datagrid [clrDgLoading]="loading" [(clrDgSelected)]="selected">
  <clr-dg-action-bar>
    <clr-button-group>
      <clr-button class="btn btn-sm btn-secondary" (click)="onCreate()">
        <clr-icon shape="plus" size="16"></clr-icon>
        创建
      </clr-button>
      <clr-button class="btn btn-sm btn-secondary" [disabled]="selected.length ==0" (click)="onDelete()">
        <clr-icon shape="close"></clr-icon>
        删除
      </clr-button>
    </clr-button-group>
  </clr-dg-action-bar>
  <clr-dg-column>名称</clr-dg-column>
  <clr-dg-column>类型</clr-dg-column>
  <clr-dg-column>创建时间</clr-dg-column>

  <clr-dg-row *clrDgItems="let item of items" [clrDgItem]="item">
    <clr-dg-cell>{{item.name}}</clr-dg-cell>
    <clr-dg-cell>{{item.type}}</clr-dg-cell>
    <clr-dg-cell>{{item.date_created |date: 'yyyy-MM-dd HH:mm:ss'}}</clr-dg-cell>
  </clr-dg-row>

  <clr-dg-footer>
    <clr-dg-pagination #pagination [clrDgPageSize]=size [clrDgTotalItems]="total" (clrDgPageChange)="list()">
      <clr-dg-page-size [clrPageSizeOptions]="[10,20,50,100]">每页</clr-dg-page-size>
      {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
      总共 {{pagination.totalItems}} 脚本
    </clr-dg-pagination>
  </clr-dg-footer>

</clr-datagrid>



